/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import {Form, Input, Radio, Select, Switch, Button } from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
import Zmage from 'react-zmage';
import Wechat_info  from './../../images/wechat_info.jpg'
const FormItem = Form.Item;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  componentDidMount() {
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 7},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };

    const {getFieldDecorator} = this.props.form;
    return (
      <div>
        {
            this.props.type==='add'&&
            <Form onSubmit={this.handleSubmit}>
              <FormItem
                {...formItemLayoutWithLabel}
                label={(
                  <span>
               下属部门名称
            </span>
                )}
              >
                {getFieldDecorator('name', {
                  initialValue: '',
                  rules: [{ required: true, message: '请输入下属部门名称' }],
                })(
                  <Input />
                )}
              </FormItem>
            </Form>
        }
        {
          this.props.type==='edit'&&
          <Form onSubmit={this.handleSubmit}>
            <FormItem
              {...formItemLayoutWithLabel}
              label={(
                <span>
               部门名称
            </span>
              )}
            >
              {getFieldDecorator('name', {
                initialValue: this.props.editRecord.name,
                rules: [{ required: true, message: '部门名称' }],
              })(
                <Input />
              )}
            </FormItem>
          </Form>
        }
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);


